#!/bin/bash
tests=43
for(( i=1; i<=tests; i++ ))
do
	if [[ $# == 0 || $1 == $i ]];
	then
	echo "Performing test $i"
	for(( m=1; m<10; m++ ))
	do
		for(( k=2; k<10; k++ ))
		do
			for(( w=k; w<=8; w++ ))
			do
				ccommand="./test"
				cppcommand="./test"
				if [ $i -lt 10 ];
				then
				ccommand="${ccommand}0"
				cppcommand="${cppcommand}0"
				fi
				cppcommand="$cppcommand${i}p $m $k $w > d2"
				ccommand="$ccommand${i}c $m $k $w > d1"
#				echo $ccommand
				echo $($ccommand)>d1
#				echo $cppcommand
				echo $($cppcommand)>d2
				diff="diff d1 d2"
				result=$($diff)
				if [ "$result" != "" ]
				then
					echo "$ccommand diff $cppcommand"
					echo $result
				fi
			done
		done
	done
	fi
done
